﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using Yunzuan.Foundation.Web;

namespace WholesalerService.Common
{
    public class GoodsType
    {
        public const int Diamond = 1; //裸钻
        public const int Parcel = 2;//统包
        public const int Ring = 3;//成品
        public const int Gem = 4;//彩宝
        public const int Emerald = 5;//翡翠 
        public const int PrimeGolds = 6;//素金  
        public const int InlaySettings = 7;//空托
        public const int Other = 8;//其他 

        public const string filters = "filters/";
        public static string BaseURL = ConfigurationManager.AppSettings["TransmissionBaseURL"];

        /// <summary>
        /// 得到商品接口
        /// </summary>
        /// <param name="filters"></param>
        /// <param name="goodsType"></param>
        /// <returns></returns>
        public static string GetGoodsURL(int goodsType = 1)
        {
            string port = "";
            switch (goodsType)
            {
                case Diamond:
                    port = BaseURL + string.Format("stocks/{0}", filters);
                    break;
                case Parcel:
                    port = BaseURL + string.Format("parcels/{0}", filters );
                    break;
                case Ring:
                    port = BaseURL + string.Format("inlays/{0}", filters );
                    break;
                case Gem:
                    port = BaseURL + string.Format("gems/{0}", filters );
                    break;
                case Emerald:
                    port = BaseURL + string.Format("emeralds/{0}", filters );
                    break;
                case PrimeGolds:
                    port = BaseURL + string.Format("prime-golds/{0}", filters );
                    break;
                case InlaySettings:
                    port = BaseURL + string.Format("inlay-settings/{0}", filters );
                    break;
            }
            return port;
        }

        /// <summary>
        /// 得到商品接口
        /// </summary>
        /// <param name="filters"></param>
        /// <param name="goodsType"></param>
        /// <returns></returns>
        public static string GetGoodsById(string param, int goodsType = 1)
        {
            string port = "";
            switch (goodsType)
            {
                case Diamond:
                    port = BaseURL + string.Format("stocks/{0}",  param);
                    break;
                case Parcel:
                    port = BaseURL + string.Format("parcels/{0}",  param);
                    break;
                case Ring:
                    port = BaseURL + string.Format("inlays/{0}",  param);
                    break;
                case Gem:
                    port = BaseURL + string.Format("gems/{0}",  param);
                    break;
                case Emerald:
                    port = BaseURL + string.Format("emeralds/{0}",  param);
                    break;
                case PrimeGolds:
                    port = BaseURL + string.Format("prime-golds/{0}",  param);
                    break;
                case InlaySettings:
                    port = BaseURL + string.Format("inlay-settings/{0}",  param);
                    break;
            }
            return port;
        }
        /// <summary>
        /// 得到商品接口
        /// </summary>
        /// <param name="filters"></param>
        /// <param name="goodsType"></param>
        /// <returns></returns>
        public static string GetGoodsPort(string filters, int goodsType = 1)
        {
            string port = "";
            switch (goodsType)
            {
                case Diamond:
                    port = GlobalConfig.BaseURL + string.Format("stocks/{0}", filters);
                    break;
                case Parcel:
                    port = GlobalConfig.BaseURL + string.Format("parcels/{0}", filters);
                    break;
                case Ring:
                    port = GlobalConfig.BaseURL + string.Format("inlays/{0}", filters);
                    break;
                case Gem:
                    port = GlobalConfig.BaseURL + string.Format("gems/{0}", filters);
                    break;
                case Emerald:
                    port = GlobalConfig.BaseURL + string.Format("emeralds/{0}", filters);
                    break;
                case PrimeGolds:
                    port = GlobalConfig.BaseURL + string.Format("prime-golds/{0}", filters);
                    break;
                case InlaySettings:
                    port = GlobalConfig.BaseURL + string.Format("inlay-settings/{0}", filters);
                    break;
            }
            return port;
        }
        public static string GetTypeName(int tType)
        {
            string typeName = "";
            switch (tType)
            {
                case GoodsType.Diamond:  //库存 
                    typeName = "裸钻";
                    break;
                case GoodsType.Parcel: //统包
                    typeName = "统包";
                    break;
                case GoodsType.Ring:   //成品
                    typeName = "成品";
                    break;
                case GoodsType.Gem:    //彩宝
                    typeName = "彩宝";
                    break;
                case GoodsType.Emerald:   //翡翠
                    typeName = "翡翠";
                    break;
                case GoodsType.PrimeGolds:    //素金
                    typeName = "素金";
                    break;
                case GoodsType.InlaySettings:    //素金
                    typeName = "空托";
                    break;
            }
            return typeName;
        }
        /// <summary>
        /// 得到商品接口
        /// </summary>
        /// <param name="filters"></param>
        /// <param name="goodsType"></param>
        /// <returns></returns>
        public static string GetGoodsShelvesUrl(string filters, int goodsType = 1)
        {
            string port = "";
            switch (goodsType)
            {
                case Diamond:
                    port = GlobalConfig.BaseURL + string.Format("stocks/{0}", filters);
                    break;
                case Parcel:
                    port = GlobalConfig.BaseURL + string.Format("parcels/{0}", filters);
                    break;
                case Ring:
                    port = GlobalConfig.BaseURL + string.Format("inlays/{0}", filters);
                    break;
                case Gem:
                    port = GlobalConfig.BaseURL + string.Format("gems/{0}", filters);
                    break;
                case Emerald:
                    port = GlobalConfig.BaseURL + string.Format("emeralds/{0}", filters);
                    break;
                case PrimeGolds:
                    port = GlobalConfig.BaseURL + string.Format("prime-golds/{0}", filters);
                    break;
                case InlaySettings:
                    port = GlobalConfig.BaseURL + string.Format("inlay-settings/{0}", filters);
                    break;
            }
            return port;
        }
    }
}